how to solve nested list programs [closed]

Posted by riya on Stack Overflow See other posts from Stack Overflow or by riya
Published on 2010-04-07T14:04:21Z Indexed on 2010/04/07 14:43 UTC
Read the original article Hit count: 258

Filed under:
|

write a function to get most popular car that accepts a car detail as input and returns the most popular car name along with its average rating .Each element of car details list is a sublist that provides the below information about a car (a)name of a car(b)car price (c) list of ratings obtained by car from various agencies.Incase two cars have the same average rating then the car with the lesser price qualifies as most popular car?

here's my solution-:

(define-struct cardetails ("name" price list of '(ratings)) (define car1 (make-cardetails "toyota" 123 '( 1 2 3))) (define car2 (make-cardetails "santro" 321 '( 2 2 3))) (define car3 (make-cardetails "toyota" 100 '( 1 2 3))) (define cardetailslist(list(car1) (car2)(car 3))) (let loop ((count 0)) (let (len (length cardetailslist)) (if(< count len)

(string-ref (string-ref n)0)

now please tell me how to find maximum average and display car name.it's not a homework question tomorrow is my test and we have not been taught this concept in class although it is very important from test point of view

© Stack Overflow or respective owner

Related posts about drscheme

Related posts about homework